<template>
	<div class="container">
		<div class="fixed-header clearfix" style="text-align: center;"><b>我的已推荐客户</b></div>
		<ul class="report-list-view">
			<li v-for="(row,index) in customerPremisesList">
				<router-link :to="{name:'declareDetail',params:{id:row.id}}" >
				<div class="report-info-cell year-time-list">
					<div class="template-list-right">
						<div class="title">{{row.name}}</div>
						<div class="content">{{row.createTime}}</div>
					</div>
					<div class="report-list-details">
						<div class="report-phone">{{row.mobile}}</div>
						<div class="report-name">{{row.premisesName}}</div>
						<div class="report-state colA">{{row.customerStatusName}}</div>
					</div>
				</div>
				</router-link>
			</li>
		</ul> 
		<!-- 弹出搜索层 -->
		<mugen-scroll :handler="list" :should-handle="!loading" >
		</mugen-scroll>
	</div>
</template>
<script>
	import MugenScroll from 'vue-mugen-scroll'
	export default{
		data(){
			return {
				modalShow: false,
				tellWrods:'',
				params:{
					pageSize:10,
					pageNo:0,
					//staffId:window.sessionStorage.getItem("userId"),
					premisesId: this.$route.params.id
				},
				customerPremisesList:[],
				customerArray:[],
				loading:false
			}
		},
		watch:{
		},
		components: {
			MugenScroll
		},
		mounted(){
			$("#goble_menu_div").show();
		},
		methods:{
			list:function(){
				var _self = this;
				_self.loading = true;
				_self.params.pageNo = _self.params.pageNo+1;
				var body = {};
				body.params = {
					pageNo:_self.params.pageNo,
					pageSize:_self.params.pageSize,
					premisesId:_self.params.premisesId
				};
				var url = _self.utilHelper.apiUrl+'/api/getCPPage';
				_self.$http.post(url,body).then((response)=>{
					var result = response.body.resData;
					if(_self.params.pageNo>result.cpDtoPage.totalPages){
						_self.loading = true;
					}else{
						for(var i=0;i<result.cpDtoPage.rows.length;i++){
							_self.customerPremisesList.push(result.cpDtoPage.rows[i]);
						}
						_self.loading = false;
					}
				},(response)=>{
					layer.alert("接口异常!");
				});
			}
		}
	}
	
</script>